package com.example.spring.bean.load02scan;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 测试配置 ComponentScan 后，怎么进行扫描的包
 * <p>
 * <p>
 */
public class ScanDemo {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ScanConfig.class);

        //返回此工厂中定义的所有 bean 的名称。
        String[] names = context.getBeanDefinitionNames();
        for (String name : names) {
            System.out.println(name);
        }

        //只输出了下面一些， Repository、Service的都未扫到
        //org.springframework.context.annotation.internalConfigurationAnnotationProcessor
        //org.springframework.context.annotation.internalAutowiredAnnotationProcessor
        //org.springframework.context.annotation.internalCommonAnnotationProcessor
        //org.springframework.context.event.internalEventListenerProcessor
        //org.springframework.context.event.internalEventListenerFactory
        //scanConfig
        //scanController

        context.close();
    }
}
